home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 3587 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.3 KB  |  36 lines

  1. Newsgroups: comp.lang.c
  2. Path: nntp.coast.net!torn!nott!emr1!jagrant
  3. From: jagrant@emr1.emr.ca (John Grant)
  4. Subject: Re: looping & sscanf
  5. Message-ID: <DLz87p.Aqu@emr1.emr.ca>
  6. Organization: Energy, Mines, and Resources, Ottawa
  7. References: <DLtqMw.8Ao@emr1.emr.ca> <DLyz1B.DvK@eskimo.com>
  8. Date: Tue, 30 Jan 1996 04:23:49 GMT
  9.  
  10. In article <DLyz1B.DvK@eskimo.com> scs@eskimo.com (Steve Summit) writes:
  11. >In article <DLtqMw.8Ao@emr1.emr.ca>, jagrant@emr1.emr.ca (John Grant) writes:
  12. >> In FORTRAN, I can read a set of numbers from a character string with an
  13. >> 'internal read'...
  14. >> How can I do this easily in C?
  15. >>...
  16. >> Perhaps I should loop through the string using strtok(), converting each
  17. >> substring using atof()?
  18. >
  19. >Something like that, yes.
  20. >
  21. >> I'm sure it's straightforward, but I just can't see it (or find it in the FAQ).
  22. >
  23. >There are some clues in there, which are expanded with an example
  24. >or two in the book-length version:
  25.     [...]
  26.  
  27.     Thanks Steve. The only clues I found were to use atof() etc & 
  28.     sscanf to solve the problems with scanf().  Your quotes from the
  29.     book were helpful. I ended up using strtok/atof, since it seemed
  30.     to have less overhead than makeargv/atof.  Of course, I'm not
  31.     considering the overhead of strtok code, whatever that is.
  32. -- 
  33. John A. Grant                        jagrant@emr1.emr.ca
  34. Airborne Geophysics
  35. Geological Survey of Canada, Ottawa
  36.